/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.worlds.ui.edge;

import java.awt.Color;
import java.awt.Font;
import java.io.IOException;
import net.worlds.AssetManager;
import net.worlds.Main;


public class GameOverlay extends EMain{
    public EFrame helpFrame;
    public EFrame topMenu;
    public EFrame rightFrame;
    private EHealthFrame healthFrame;
    private ELeaderboard leaderboard;
    public GameOverlay(int width, int height)
    {
        super(width, height);
        topMenu = new EStickyFrame(this, -1, 24, 0, 0, -1, 0);
        topMenu.setUndecorated(true);
        topMenu.setBackgroundColor(new Color(127, 136, 154));
        rightFrame = new EStickyFrame(this, 121, 24, 0, -1, -1, 0);
        rightFrame.setBackgroundColor(new Color(0, 0, 0, 0));
        rightFrame.setUndecorated(true);
        rightFrame.setLayer(2);
        healthFrame = new EHealthFrame(0, 0);
        topMenu.addChild(2, healthFrame);
        EButton helpButton = null;
        try {
            helpButton = new EButton(AssetManager.loadImage("help_off.png", "help_off.png"));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        helpButton.setHeight(24);
        helpButton.setWidth(40);
        helpButton.setX(81);
        helpButton.setActionListener(new EActionListener()
        {

            @Override
            public void actionPerformed() {
                helpFrame.setVisible(true);
            }
            
        });
        EButton backButton = null;
        try {
            backButton = new EButton(AssetManager.loadImage("exit.png", "exit.png"));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        backButton.setHeight(24);
        backButton.setWidth(40);
        backButton.setX(41);
        backButton.setActionListener(new EActionListener()
        {

            @Override
            public void actionPerformed() {
                Main.showMenu();
            }
            
        });
        //rightFrame.addChild(3, backButton);

        helpFrame = new EFrame(this, 200, 125, 400, 250);
        helpFrame.addTitle("2DWorlds Help");
        ELabel controlsLabel = new ELabel("Game Controls");
        controlsLabel.setColor(new Color(197, 203, 217));
        controlsLabel.setFont(new Font("Arial", Font.BOLD, 16));
        helpFrame.addChild(1, controlsLabel);
        controlsLabel.setX(6);
        controlsLabel.setY(28);
        String[] lines = {"* a, left arrow - move left",
        "* d, right arrow - move right",
        "* s, down - move down (in water)",
        "* shift - run",
        "* w, up arrow - jump",
        "* 1-9 - select tool",
        "* Q - drop tool (if applicable)"};
        /*String[] lines = {"* left mouse button- select",
        "* right mouse button - move camera",
        "* mouse wheel or (+), (-) - zoom",
        "* shift - multi select",
        "* delete - delete selection"};*/
        int y = 47;
        Font lineFont = new Font("Arial", -1, 13);
        for(String l : lines)
        {
            ELabel lineLabel = new ELabel(l);
            lineLabel.setFont(lineFont);
            lineLabel.setX(6);
            lineLabel.setY(y);
            helpFrame.addChild(1, lineLabel);
            y += 17;
        }
        helpFrame.visible = false;
        addChild(1, helpFrame);
        leaderboard = new ELeaderboard(this, 10, 30);
    }
}
